{extend name="common:base" /}

{block name="title"}重置密码- 天佑二手货{/block}
{block name="page"}auth{/block}

{block name="header"}
<header>
    <div class="am-g">
        <h1>天佑二手货</h1>
        <p>TianYou Secondary Market
            <br/>交大人自己的二手市场！</p>
    </div>
    <hr />
</header>
{/block}

{block name="main"}
<div class="am-g am-g-fixed">
    <div class="am-u-sm-6 am-u-sm-centered">
        <h3>重置密码</h3>
        <hr>
        <br>
        <br>
        <form class="am-form">
            <label for="password">密码:</label>
            <input type="password" name="password" id="password" value="">
            <br>
            <label for="repassword">密码确认:</label>
            <input type="password" name="repassword" id="repassword" value="">
            <br />
            <br>
            <br />
            <div class="am-cf">
                <input type="submit" name="" value="确认" class="am-btn am-btn-primary am-btn-sm am-fl">
            </div>
        </form>
    </div>
</div>
{/block}

{block name="js"}
<script type="text/javascript">
    $('.am-form').submit(function(event) {
        event.preventDefault();
        var url = location.href;
        $.ajax({
            url: url,
            type: 'POST',
            data: $('.am-form').serialize(),
            success: function(data) {
                console.log(data);
                $alert = $('#am-alert');
                $alert.find('.content').text(data.msg);
                $alert.modal('open');
                if(data.code) {
                    setTimeout(function() {
                        location.href = data.url;
                    }, data.wait * 1000);
                } else {
                    $('#captcha-img').click();
                }
            }
        })
    });

</script>
{/block}
